#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<string> a;
int mother[10000];


int comparelarger(int root,int mother){
    
    
}

int main(){
    int count=0;
    char c;
    string ch="";
    while ((c=getchar())!='\n'){
        if (c!=' '){
            ch+=c; 
        }
        else{
            a.push_back(ch);
            ch.clear();
            count++;
            
        }
    }
    a.push_back(ch);
    count++;
    int thisline=2;//这一行有多少个
    int thislineused=0;
    int thislinecount=0;//下一行结束时的编号为多少
    int nextline=0;//下一行有多少个
    mother[0]=-1;

    for (int i=1; i<count; i++){
        if (thislineused==thisline){
            thislineused=0;
            thisline=thislinecount;
            thislinecount+=nextline;
            nextline=0;
        }
        
        if (a[i]!="null"){
            nextline+=2;
            if (thisline+nextline-2<count)mother[thisline+nextline-2]=i;
            if (thisline+nextline-1<count)mother[thisline+nextline-1]=i;
        }
        thislineused++;

    }

    return 0;
}